<?php
	// Set title, form destination
	$post = $vars['entity'];
	$access_id = $vars['entity']->access_id;
  $message="";
	$context=get_input('type');
	global $tokeninput;
	$tokeninput = true;
?>
<script type="text/javascript">
	$(document).ready(function(){
		$(".tokenize").tokenInput("<?php echo $vars['url']; ?>action/validation_peda/friendsearch", {
			hintText: "Entrez le nom des destinataires",
			noResultsText: "Aucun résultat",
			searchingText: "Recherche...",
			classes: {
				tokenList: "token-input-list-facebook",
				token: "token-input-token-facebook",
				tokenDelete: "token-input-delete-token-facebook",
				selectedToken: "token-input-selected-token-facebook",
				highlightedToken: "token-input-highlighted-token-facebook",
				dropdown: "token-input-dropdown-facebook",
				dropdownItem: "token-input-dropdown-item-facebook",
				dropdownItem2: "token-input-dropdown-item2-facebook",
				selectedDropdownItem: "token-input-selected-dropdown-item-facebook",
				inputToken: "token-input-input-token-facebook"
			}
		});
	});
</script>
  <?php
    $listnoms=elgg_view('input/text', array('internalname' => 'autobox', 'value' => '' , 'class' => 'tokenize'));
    $message=elgg_view('input/longtext', array('internalname' => 'message', 'value' => $message));
    $submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('Enregistrer')));
    $entity_hidden = elgg_view('input/hidden', array('internalname' => 'guid', 'value' => $vars['entity']->getGUID()));
    $type_hidden = elgg_view('input/hidden', array('internalname' => 'type', 'value' => $context));
    $titre=elgg_view_title(elgg_echo('avis:demande'));
    $indication=elgg_echo('avis:indications');
		
$form_body = <<<EOT
    <div>
      $titre
      <p>$indication</p><br/>
    </div>
    <div>
      $listnoms
    </div>
    <div>
      $message
    </div>
    <div>
			$entity_hidden
			$type_hidden
			$url_hidden
			$submit_input
    </div>
    <div id="log"></div>
EOT;
  
    echo elgg_view('input/form', array(	'action' => "{$vars['url']}action/validation_peda/demande",'body' => $form_body));
  ?>
